<template>
	<div>
		<el-form ref="form" :model="form" label-width="100px">
			<el-form-item label="姓名" prop="customerName">
				<el-input v-model="form.customerName"></el-input>
			</el-form-item>
			<el-form-item label="性别" prop="customerSex">
				<el-input v-model="form.customerSex"></el-input>
			</el-form-item>
			<el-form-item label="年龄" prop="customerAge">
				<el-input v-model="form.customerAge"></el-input>
			</el-form-item>
			<el-form-item label="护理级别" prop="nurseLevel">
				<el-select v-model="form.nurseLevel" placeholder="请选择护理级别"  clearable
					:style="{width: '100%'}">
					<el-option v-for="(item, index) in NursingLevelData" :key="index" :label="item.nclass"
						:value="item.nclass" :disabled="item.disabled"></el-option>
				</el-select>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>

<script>
	export default {
		name: 'ServicesFocusEdit',
		components: {},
		props: [
			'showEdit',
			'customerId',
			'editid'
		],
		data() {
			return {
				form: {
					customerId: '',
					customerName: '',
					customerSex: '',
					customerAge: '',
					nurseLevel: ''
				},
				NursingLevelData: [],
				url: '/services-focus/save',
				registerlevel: [],
				depts: [],
			}
		},
		created() {
			if (this.editid) {
				this.axios.get('/services-focus/toedit', response => {
					this.form.customerId = response.obj.customerId
					this.form.customerName = response.obj.customerName
					this.form.customerSex = response.obj.customerSex
					this.form.customerAge = response.obj.customerAge
					this.form.nurseLevel = response.obj.nurseLevel
				}, {
					id: this.editid
				})
			}
			
			this.axios.get('/nurseClass/getAllList',res=>{
				console.log(res)
				this.NursingLevelData=res.obj
			})
			
			
		},
		methods: {
			save() {
				this.$refs['form'].validate((valid) => {
					if (valid) {
						this.axios.post(this.url, response => {
							// 子组件要改变父组件的值
							this.$emit('update:show', false)
							this.$emit('getData')
						}, this.form)
					}
				})
			}

		}
	}
</script>

<style>
</style>
